2-1: RStudio projects

Overview

In this practical we will look at RStudio projects as a means to organise your workflow.

Background

For more information, follow this link.

Tasks

We have written a function that will generate an RStudio project for you to look at. In the following example, we have set ~/Desktop/git as our working directory (this is where we keep all of our projects) and run dummy_project(), without any arguments.

A new instance of RStudio should open:

You should find that (1) your working directory is now project0201, (2) inside this directory are three files, and (3) an RStudio project has been set up, called project0201. Of the three files, two should be familiar to you - the script and step function from Practical 1-5. The third file, project0201.Rproj, is an RStudio project file, which is used to make this directory an RStudio project, and can be used as a shortcut for opening this project from your filesystem.

Now.. let’s make a new RStudio project. In RStudio, click File > New project > New Directory > Empty Project, and then choose a location and a name for the project. You should notice that (1) your working directory has changed, (2) inside of this directory there is only one file, an Rproj file, and (3) an RStudio project has been set up. If you click on the name of your new project in the top right corner of RStudio, you should see (4) a list of recently opened projects.

Click on project0201 to reopen the original project and you should find that your working directory has changed back to project0201, and all your files are there where you left them. This is an easy way to organise your workflow and quickly switch between projects.